import java.util.Random;
import java.util.Scanner;

public class Challenge6//simple RPG
{
	public static int marioHP = 20;
	public static int goombaHP = 5;
	public static int bowserHP = 10;
	
	public static void main(String[] args)
	{	
		Scanner input = new Scanner(System.in);
		Random randomNumberGenerator = new Random();

		int marioRoll = 0;
		int enemyRoll = 0;
		String userSelection = "";
		
		while(!userSelection.equals("r") && goombaHP > 0)
		{
			System.out.println("------------------------");
			System.out.println("Please make a selection.");
			System.out.println("(a)ttack");
			System.out.println("(r)un");
			
			System.out.print("Selection: ");
			userSelection = input.next();//get user's selection
			
			switch(userSelection)
			{
				case "a":
					marioRoll = randomNumberGenerator.nextInt(6);
					enemyRoll = randomNumberGenerator.nextInt(6);
					
					System.out.println("Mario's Dice Roll: " + marioRoll);
					System.out.println("Goomba's Dice Roll: " + enemyRoll);
					
					if(marioRoll >= enemyRoll)
					{
						System.out.println("Mario hit Goomba and does 1 damage.");
						goombaHP -= 1;
					}
					else
					{
						System.out.println("Goomba hit Mario and does 1 damage.");
						marioHP -= 1;
					}
					break;
				case "r":
					System.out.println("You run!");
					break;
			}
			printAllHP();
		}
	}
	
	public static void printAllHP()
	{
		System.out.println("   ==================================");
		System.out.println("   =    Mario HP: " + marioHP);
		System.out.println("   =    Goomba HP: " + goombaHP);
		System.out.println("   =    Bowser HP: " + bowserHP);
		System.out.println("   ==================================");
	}
}
